<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>TZ-追梦</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <div class="a b c d"></div>
    <script>
        //var aDiv = document.querySelector('div');
        var aDiv = document.querySelectorAll('div')[0];
        //console.log( typeof aDiv.classList ); // 对象类型
        //console.log( aDiv.classList );
        //console.log( aDiv.classList.length );
        //console.log( aDiv.classList[3] );
        //aDiv.classList.add('abc');
        //aDiv.classList.remove('a');
        //aDiv.classList.toggle('xyz')
        if( !aDiv.classList.contains('b') ){
            aDiv.classList.add('b');
        }else{
            aDiv.classList.remove('b');
        }
        console.log(  );
    </script>
</body>
</html>